﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.intellitack.layar.library
{
    public class LayarRequest:ILayerObject
    {
        #region Protected Properties
        protected string _userID;
        protected string _developerID;
        protected string _developerHash;
        protected Int64? _timeStamp;
        protected string _layerName;
        protected decimal? _lat;
        protected decimal? _lon;
        protected Int64? _accuracy;
        protected string _radioList;
        protected string _searchBox;
        protected Int64? _radius;
        protected decimal? _customerSlider;
        protected string _pageKey;
        protected string _oAuthCustomerKey;
        protected string _oAuthSignatureMethod;
        protected Int64? _oAuthTimeStamp;
        protected string _oAuthNonce;
        protected string _oAuthVersion;
        protected string _oAuthSignature;
        #endregion

        #region Public Properties
        /// <summary>
        /// Uinique ID of the end-user, anoymized.
        /// </summary>
        public string userId
        {
            get
            {
                return _userID;
            }
            set
            {
                _userID = value;
            }
        }

        /// <summary>
        /// The developer ID
        /// </summary>
        public string developerID
        {
            get
            {
                return _developerID;
            }
            set
            {
                _developerID = value;
            }
        }

        /// <summary>
        /// The hash is passed in the request as a simple method to verify the authenticity of the request.  
        /// Alternatively the OAuth signature can be used.
        /// The devloperKey is entered together with the developerID by the user in the corresping setting field in the client.
        /// The hash is obtained in the following way:
        ///    -Append the timestamp as a string to the developerKey
        ///    -Make sure the string is encoded using ASCOO
        ///    -Calcuate the SHA-1 hast to the so obtained string.
        /// </summary>
        public string developerHash
        {
            get
            {
                return _developerHash;
            }
            set
            {
                _developerHash = value;
            }
        }

        /// <summary>
        /// Unique timestamp to the hash key
        /// </summary>
        public Int64? timestamp
        {
            get
            {
                return _timeStamp;
            }
            set
            {
                _timeStamp = value;
            }
        }

        /// <summary>
        /// Identifier of the Layer
        /// </summary>
        public string layerName
        {
            get
            {
                return _layerName;
            }
            set
            {
                _layerName = value;
            }
        }

        /// <summary>
        /// Latitude of the current position (GPS coordinate)
        /// </summary>
        public decimal? lat
        {
            get
            {
                return _lat;
            }
            set
            {
                _lat = value;
            }
        }

        /// <summary>
        /// Longitute of the current position (GPS coordinate)
        /// </summary>
        public decimal? lon
        {
            get
            {
                return _lon;
            }
            set
            {
                _lon = value;
            }
        }

        /// <summary>
        /// The accuracy of the current location, given by the device
        /// </summary>
        public Int64? accuracy
        {
            get
            {
                return _accuracy;
            }
            set
            {
                _accuracy = value;
            }
        }

        /// <summary>
        /// Optional:  The option id corresponding to the value of the raido button list option selected by the user (or default value if not changed)
        /// </summary>
        public string RADIOLIST
        {
            get
            {
                return _radioList;
            }
            set
            {
                _radioList = value;
            }
        }

        /// <summary>
        /// Optional:  The search term entered by the user
        /// </summary>
        public string SEARCHBOX
        {
            get
            {
                return _searchBox;
            }
            set
            {
                _searchBox = value;
            }
        }

        /// <summary>
        /// The value for the search radius selected by the user in the RANGE_SLIDER, or, in not specified, a default radius is used
        /// </summary>
        public Int64? radius
        {
            get
            {
                return _radius;
            }
            set
            {
                _radius = value;
            }
        }

        /// <summary>
        /// Optional:  The value for the custom slider selected by the User
        /// </summary>
        public decimal? CUSTOM_SLIDER
        {
            get
            {
                return _customerSlider;
            }
            set
            {
                _customerSlider = value;
            }
        }

        /// <summary>
        /// Optional:  If the results are spread over more pages, the Layar Server can request the next page 
        /// using the pageKey (if received in the prevous response).
        /// 
        /// Pagination:  The user is waiting for the screen to fill with POIs when he selects a layar.  It
        /// is therfore important to return results as quickly as possible.  The API offers the possibility to 
        /// to split the results in pages to speed up the process.
        /// 
        /// We typically expect around 10 results per page.
        /// 
        /// If the Layer Service Provider uses pagination for the results (this is options), it can let the Layer
        /// Server know that there are more results by setting the 'morePage' parameter to true and passing a
        /// nextPageKey (this is a string, may be a page number or a key).  The Layar Server will use this key in its
        /// next request (pageKey parameter) if it wants to fetch the next page of results.
        /// 
        /// Recommendations for number of POIs:
        ///   -Only the first 50 POIs returned to the client will be displayed
        ///   -Aim to return nome more than 50 POIs within the search radius.  If the search radius is very large containing 
        ///    many more POIs, return just the 50 closest POIs or the 50 most relevant POIs (depending on the situation, that's
        ///    up to you).
        ///   -Because the cleint fetches the POIs over-the-air, using paging is recommend for more than 15 results.  Try to
        ///    spilt the resutls in pages of 10 results.
        /// </summary>
        public string pageKey
        {
            get
            {
                return _pageKey;
            }
            set
            {
                _pageKey = value;
            }
        }

        /// <summary>
        /// Optional:  OAuth Consumer Key:  The developer can submit this key using the Layer Provisioning Website
        /// </summary>
        public string oauth_consumer_key
        {
            get
            {
                return _oAuthCustomerKey;
            }
            set
            {
                _oAuthCustomerKey = value;
            }
        }

        /// <summary>
        /// Optional:  This will always be HMAC-SHA1
        /// </summary>
        public string oauth_signature_method
        {
            get
            {
                return _oAuthSignatureMethod;
            }
            set
            {
                _oAuthSignatureMethod = value;
            }
        }

        /// <summary>
        /// Optional:  Timestamp for the request
        /// </summary>
        public Int64? oauth_timestamp
        {
            get
            {
                return _oAuthTimeStamp;
            }
            set
            {
                _oAuthTimeStamp = value;
            }
        }

        /// <summary>
        /// Optional:  Unique nonce to rule out replay attacks
        /// </summary>
        public string oauth_nonce
        {
            get
            {
                return _oAuthNonce;
            }
            set
            {
                _oAuthNonce = value;
            }
        }

        /// <summary>
        /// Optional:  Oauth version used.
        /// </summary>
        public string oauth_version
        {
            get
            {
                return _oAuthVersion;
            }
            set
            {
                _oAuthVersion = value;
            }
        }

        /// <summary>
        /// Optional:  HMAC-SHA1 signature using the Signature Base String as text and teh Consumer Secret (no toke secret) as key.  The consumer secret is submitted by the developer on the Layar Provisioning Website.
        /// </summary>
        public string oauth_signature
        {
            get
            {
                return _oAuthSignature;
            }
            set
            {
                _oAuthSignature = value;
            }
        }

        #endregion

    }
}
